const  newsService  = require('../../services/web/newsService');



const newsController = {
    
    // 获取新闻列表
    list: async(req, res , next) => {
        const result = await newsService.list()

        res.send({
            ActionType: "OK",
            status: 200,
            data: result
        })
    },
  
    // 获取新闻详情
    detail: async (req, res, next) => {
        const id  = req.query.id
        const result = await newsService.detail(id);

        res.send({
            ActionType: "OK",
            status: 200,
            data: result
        })
    },

    // 获取最新新闻
    recent: async (req, res, next) => {
        const limit = req.query.limit

        const result = await newsService.recent(limit);

        res.send({
            ActionType: "OK",
            status: 200,
            data: result
        })
    }
    
}

module.exports = newsController;